#include "log.h"
#include <stdarg.h>

void log(LogLevel level, const char* format, ...){
    time ti = {0};
    get_current_time(&ti);
    char title[1024] = {0};
    vsnprintf(title, "%d-%d-%d %d:%d:%d [%s] [function = %s, line = %d] - ", ti.year, ti.month, ti.day, ti.hour, ti.minute, ti.second, enumToStr(level), __FUNCTION__, __LINE__);
    char info[1024] = {0};

    va_list ap;  
    va_start(ap,format);
    vsnprintf(info, format, ap);
    va_end(ap);

    char* result[2048] = {0};      
    strcat(result, title, info);
    printk(result);
}
